package edu.sctu.nieyu.day20150518;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by user01 on 2015/5/19.
 */
public class TextMore {
    protected Teacher[] teacher;

    public TextMore(Teacher[] teacher) {
        this.teacher = teacher;
    }


    public Teacher[] sotrNumber() {
        Teacher[] teacherA = new Teacher[teacher.length];
        for (int i = 0; i < (teacher.length - 1); i++) {
            for (int j = 0; j < (teacher.length - 1); j++) {
                if (teacher[j].number > teacher[j + 1].number) {
                    teacherA[0] = teacher[j];
                    teacher[j] = teacher[j + 1];
                    teacher[j + 1] = teacherA[0];
                }

            }
        }
        return teacher;
    }


    public void sortStudent(Student[] student) {
        Student[] teacherA = new Student[student.length];
        for (int i = 0; i < (student.length - 1); i++) {
            for (int j = 0; j < (student.length - 1); j++) {
                if (student[j].grade > student[j + 1].grade) {
                    teacherA[0] = student[j];
                    student[j] = student[j + 1];
                    student[j + 1] = teacherA[0];
                }

            }
        }
    }


    public List<Teacher> pritCoded() {
        List<Teacher> list = new ArrayList<>();
        for (int i = 0; i < teacher.length; i++) {
            if (teacher.equals("教授"))
               list.add(teacher[i]);
        }


        return list;

    }

}
